<template>
  <tr>
    <td><input type="checkbox" :checked="obj.checked" @change="$emit('change', $event.target.checked)" /></td>
    <td>{{ obj.name }}</td>
    <td>{{ obj.price }}</td>
    <td>
      <button @click="$emit('add')">+</button>
      {{ obj.num }}
      <button :disabled="obj.num === 0" @click="$emit('sub')">-</button>
    </td>
    <td>{{ obj.price * obj.num }}</td>
    <td>
      <button @click="$emit('remove', index)">删除</button>
    </td>
  </tr>
</template>

<script>
export default {
  data() {
    return {}
  },
  methods: {},
  components: {},
  computed: {},
  watch: {},
  created() {},
  props: {
    obj: {
      type: Object,
      required: true
    },
    index: Number
  }
}
</script>

<style scoped></style>